
/**
 *  @file
 *  @brief SPC 单元数据
 *
 *  @author  yuanchenxi
 *  @date    2024.07.25
 *  @version  v1.0
 *  @par Copyright(c):  ShenGong  Simulation corporation
 */

#pragma once
#include <vector>

#include "DataStructure/Common/DataStructureExport.h"
#include "DataStructure/Common/DataStructureNamespace.h"
#include "DataStructure/Common/Id.h"
#include "DataStructure/Common/Real.h"
#include "DataStructure/Common/SetBase.h"
#include "DataStructure/Input/Solver/DOFDirections.h"

SG_DATASTRUCTURE_FEM_NAMESPACE_OPEN
/// @brief 单点约束
struct DECLSPEC SPCData : public SetBase
{
    SG::DataStructure::Common::Id   m_g        = 0;    ///< 节点号
    SG::DataStructure::Common::Id   m_c        = 0;    ///< 自由度方向
    SG::DataStructure::Common::Real m_d        = 0.0;  ///< 约束对应的值
    SG::DataStructure::Common::Id   m_domainId = 0;    ///< 约束自由度方向

    /**
     * @brief 获取自由度方向
     *
     * 返回自由度方向的实例。
     *
     * @return 自由度方向的实例
     */
    DofSet GetIndexes () const;
};

using SPCDataArray = std::vector<SG::DataStructure::FEM::SPCData>;
using SPCDData     = SPCData;

/// @brief 判断两个SPCData是否相等
/// @param a
/// @param b
/// @return
DECLSPEC bool operator== (const SPCData &a, const SPCData &b);

/// @brief 比较两个SPCData大小
/// @param SGDataA
/// @param SGDataB
/// @return
DECLSPEC bool operator< (const SPCData &SGDataA, const SPCData &SGDataB);

SG_DATASTRUCTURE_FEM_NAMESPACE_CLOSE